package gnssio

import (
	"time"
)

var (
	ACTION_STOP = 1000

	ACTION_QryStatus           = 0
	ACTION_QryStatus_FirstRecv = 10
	ACTION_Status_Reset        = -1
)

// 接受数据事件
type EventOnRecv func(sender interface{}, buffer []byte)
type NotifyEvent func(sender interface{})

type I_Comm interface { //tcp, udp, ntrip
	Start()
	Stop()
	Send(buf []byte, l int) int
	AddListener(event I_CommListener)
	RemoveListener(event I_CommListener)
}

type I_Comm_Ex interface {
	GetFromAddr() string
	GetDisInfo() string
}

type I_Comm_Setter interface {
	SetComm(comm I_Comm)
	UnSetComm(comm I_Comm)
}

type I_Notify interface {
	OnRecvNotify(action int, sender interface{})
}

type I_CommListener interface {
	OnReceive(sender I_Comm, buf []byte, l int)
	OnConnect(sender I_Comm)
	OnDisconnect(sender I_Comm)
}

type I_QryStatus interface {
	QryStatus(action int) string
}

type I_OnRecvEvent interface {
	SetOnRecv(event EventOnRecv)
}

type I_OnDisEvent interface {
	SetOnDisEvent(event NotifyEvent)
}

type I_OnConnectedEvent interface {
	SetOnConnectedEvent(event NotifyEvent)
}

type I_Buffer_Processor_Maker interface {
	CreateBufferProcessor(args ...interface{}) I_Buffer_Processor
	ReleaseBufferProcessor(processor I_Buffer_Processor)
}

type I_Buffer_Processor interface {
	/// r, 0:需要更多的buffer, 1: 处理成功
	OnBufferProcess(buf []byte, l int) (r int, rvalBuf []byte)
}

type i_processor interface {
	Process(buf []byte, len int)
}

type I_UpdateVer_Property interface {
	GetVersion() int64
	SetVersion(val int64)
}

type I_Reload_Checker interface {
	SetUptime(val time.Time)
	CheckUpdate(val time.Time) bool
}
